package com.example.mapp;

import com.example.entity.CustomReport;
import com.example.mapp.buildSql.CustomReportMappSql;
import com.example.mapp.buildSql.JgCustomCountMappSql;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * 自定义导出表格
 */
@Mapper
public interface CustomReportMapp {

    //通过id查询SQL语句
    @SelectProvider(type = CustomReportMappSql.class,method = "findlists")
    public List<CustomReport> findList(CustomReport customReport) throws Exception;

    // 新增数据
    @Insert(" insert into custom_report (report_name,is_null_parm,sql_sentence,create_by,create_date,del_flag )" +
            "value " +
            "(#{reportName},#{isNullParm},#{sqlSentence},#{createBy},#{createDate},#{delFlag})")
    public void insert(CustomReport customReport) throws Exception;

    // 修改数据
    @Update("update custom_report set report_name=#{reportName},is_null_parm=#{isNullParm},sql_sentence=#{sqlSentence},"+
            "update_by=#{updateBy},update_date=#{updateDate} where id=#{id}")
    public void update(CustomReport customReport) throws Exception;

    // 删除数据
    @Update("update custom_report set del_flag='0' where id=#{id}")
    public void delete(String id) throws Exception;

}
